Skip to content

Define theme setting for Google Maps API key#187

Merged
matt-bernhardt merged 1 commit intomasterfrom
pw-172
Sep 22, 2025
Merged

Define theme setting for Google Maps API key#187
matt-bernhardt merged 1 commit intomasterfrom
pw-172

Conversation

@matt-bernhardt
Copy link
Copy Markdown
Member

@matt-bernhardt matt-bernhardt commented Sep 18, 2025

This converts a hard-coded Google Maps key into a configurable theme setting, which will make it easier to rotate and manage the key value without code changes.

Please note that the key is not a sensitive value - it is sent to user agents in order for users' browsers to connect with and load Google Maps content. This change makes the key slightly less visible, but there are separate security restrictions managed for the key to prevent unauthorized use.

Ticket: https://mitlibraries.atlassian.net/browse/PW-172

Developer

Stylesheets

  • Any theme or plugin whose stylesheets have changed has had its version
    string incremented.

Secrets

  • All new secrets have been added to Pantheon tiers
  • Relevant secrets have been updated in Github Actions
  • All new secrets documented in README
  • No secrets are affected

Documentation

  • Project documentation has been updated
  • No documentation changes are needed

Accessibility

  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • There are no accessibility ramifications to this change

Stakeholder approval

  • Stakeholder approval has been confirmed
  • Stakeholder approval is not needed

Dependencies

NO dependencies are updated

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • The changes have been verified
  • The documentation has been updated or is unnecessary
  • New dependencies are appropriate or there were no changes

** Why are these changes being introduced:

* We received a bug report for having the Google Maps API key in our
repository as a security vulnerability.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/pw-172

** How does this address that need:

* While we disagree that this represents a security vulnerability - the
key is sent to all website users in order to load map assets - there is
also no need to handle the key directly in our source code. This defines
a theme settings field that will store this key going forward, which
will also allow us to rotate the key more easily without a code change.

* The access granted to our maps key has also been restricted, which
results in less ability for users to spot the key (as happened here)
and then probe its ability for related APIs that are not needed but
were inadvertently authorized.

** Document any side effects to this change:

* It is marginally easier for non-developers to manage this key now.
Copy link
Copy Markdown

@djanelle-mit djanelle-mit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

I was able to confirm that the settings page exists, it stores a value, an incorrect value breaks the maps, and the correct value has the map appear on the location page.

@matt-bernhardt matt-bernhardt merged commit 8762e80 into master Sep 22, 2025
3 checks passed
@matt-bernhardt matt-bernhardt deleted the pw-172 branch September 22, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants